import time
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager

#1、打开浏览器---驱动管理
ChromeIns = ChromeDriverManager().install()
#创建谷歌浏览器读取对象
driver = webdriver.Chrome(service=Service(ChromeIns))
driver.get("https://www.baidu.com")

#打开新的标签页: 百度图片
driver.find_element(By.CSS_SELECTOR,"#s-top-left > a:nth-child(6)").click()
time.sleep(3)
driver.close()      #关闭的是"百度一下"页面,留下"百度图片"
time.sleep(3)
driver.quit()       #关闭整个浏览器